<?php
$operation = Jpublic::get('operation');

$id = Jpublic::get('id');

$info = Jdb::select("SELECT * FROM `".PRE."detection` WHERE detectionID = $id");

$detection_list = Jdb::getRs("SELECT * FROM `".PRE."detection_list` WHERE detectionParentID = $id");

$i = 0;

while ($dr = mysql_fetch_array($detection_list)) {
	
	$detectionListTypeHTML = $HTML -> checkBoxList('detection-1', 'detectionListType$i', $dr['detectionListType']);
	
	$detectionListBasisHTML = $HTML -> checkBoxList('detection-2', 'detectionListBasis$i', $dr['detectionListBasis']);
	
	$detectionListConclusionHTML = $HTML -> checkBoxList('detection-3', 'detectionListConclusion$i', $dr['detectionListConclusion']);
	
	$info_list .= <<< EOF
	
		<tr class="checkbox-list">
			<td><input type="text" class="reg_form" name="detectionListName$i" value="$dr[detectionListName]" /></td>
			<td>$detectionListTypeHTML</td>
			<td>$detectionListBasisHTML</td>
			<td><input type="text" class="reg_form" name="detectionLisAccording$i" value="$dr[detectionLisAccording]" /></td>
			<td><input type="text" class="reg_form" name="detectionListMode$i" value="$dr[detectionListMode]" /></td>
			<td><input type="text" class="reg_form" name="detectionListReason$i" value="$dr[detectionListReason]"  /></td>
			<td>$detectionListConclusionHTML</td>
		</tr>
		
EOF;
	
}
?>
<style>
.checkbox-list label {
	display: block;
	white-space:nowrap; 
}
</style>
<form action="<?php echo ACTION . '?action=member&mod=detection-form/detection-form-server&type=' . $operation . '&id=' . $id . '&formhash=' . JAdmin_core::formHASH();?>" method="post" onsubmit="return check(this);">
	<div class="table-div">
		<table border="0" cellspacing="1" class="table-bg width-100">
			<tr>
				<td colspan="8" align="center">常州市农产品质量安全监测情况表</td>
			</tr>
			<tr>
				<td width="10%" align="center">受检单位</td>
				<td colspan="3"><input type="text" class="reg_form" name="company" value="<?php echo $info['company'];?>" /></td>
				<td width="11%" align="center">负责人</td>
				<td colspan="3"><input type="text" class="reg_form" name="person" value="<?php echo $info['person'];?>" /></td>
			</tr>
			<tr>
				<td align="center">通讯地址</td>
				<td colspan="3"><input type="text" class="reg_form" name="address" value="<?php echo $info['address'];?>" /></td>
				<td align="center">联系方式</td>
				<td colspan="3"><input type="text" class="reg_form" name="contact" value="<?php echo $info['contact'];?>" /></td>
			</tr>
			<tr>
				<td align="center">任务来源</td>
				<td width="26%"><input type="text" class="reg_form" name="origin" value="<?php echo $info['origin'];?>" /></td>
				<td colspan="2" align="center">执行标准</td>
				<td align="center"><input type="text" class="reg_form" name="standard" value="<?php echo $info['standard'];?>" /></td>
				<td width="11%" align="center">采样时间</td>
				<td width="28%" colspan="2"><input type="text" class="reg_form" name="samplingtime" value="<?php echo $info['samplingtime'];?>" /></td>
			</tr>
			<tr>
				<td align="center">采样地点</td>
				<td colspan="3"><input type="text" class="reg_form" name="samplingaddress" value="<?php echo $info['samplingaddress'];?>" /></td>
				<td align="center">采样人员</td>
				<td colspan="3"><input type="text" class="reg_form" name="samplingperson" value="<?php echo $info['samplingperson'];?>" /></td>
			</tr>
			<tr>
				<td align="center">检测单位</td>
				<td colspan="3"><input type="text" class="reg_form" name="detectcompany" value="<?php echo $info['detectcompany'];?>" /></td>
				<td align="center">联系方式</td>
				<td colspan="3"><input type="text" class="reg_form" name="samplingcontact" value="<?php echo $info['samplingcontact'];?>" /></td>
			</tr>
		</table>
		<table border="0" cellspacing="1" class="table-bg width-100" style="margin-top: -1px;">
			<tr>
				<td colspan="7" align="center">检测情况</td>
			</tr>
			<tr>
				<td width="10%" align="center">名称</td>
				<td width="13%" align="center">产品类别</td>
				<td width="13%" align="center">检测类别</td>
				<td width="13%" align="center">检测依据</td>
				<td width="17%" align="center">检测方式</td>
				<td width="24%" align="center">不合格原因</td>
				<td width="10%" align="center">检测结论</td>
			</tr>
			<?php echo $info_list;?>
			<tr>
				<td><input type="hidden" name="detectionListNumber" value="2" /></td>
				<td colspan="7"><button type="submit" class="submit">提交</button><button type="reset" class="submit">重填</button></td>
			</tr>
		</table>
	</div>
</form>